import { WarehouseComponent } from './components/warehouse/warehouse.component';
import { platformsettingComponent } from './components/platformsettings/platformsettings.component';
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { SettingsService } from './services/settings.service';
import { RepositoryListService } from './services/repository-list.service';

import { SettingsComponent } from './components/settings/settings.component';
import { InfoComponent } from './components/info/info.component';
import { EnterpriseComponent } from './components/enterprise/enterprise.component';
import { ProfileComponent } from './components/profile/profile.component';
import { ClientUpdateComponent } from './components/client-update/client-update.component';
import { ClientUpdateService } from './services/client-update.service';
import { ArchitectureService } from './services/architecture.service';
import { CanActiveSuperAdmin } from 'app/core/auth/can-active-super-admin';

const routes: Routes = [
	{
		path: '',
		pathMatch: 'full',
		redirectTo: 'info',
	},
	{
		path: '',
		data: {
			title: '系统设置',
		},
		component: SettingsComponent,
		children: [
			{
				path: 'info',
				data: {
					title: '信息',
				},
				component: InfoComponent,
				runGuardsAndResolvers: 'always',
				resolve: {
					profile: SettingsService,
				},
			},
			{
				path: 'admin',
				loadChildren: 'app/modules/admin-manager/admin-manager.module#AdminManagerModule',
			},
			{
				path: 'enterprise',
				data: {
					title: '企业定制',
				},
				component: EnterpriseComponent,
				runGuardsAndResolvers: 'always',
				resolve: {
					profile: SettingsService,
        },
        canActivate: [CanActiveSuperAdmin]
			},
			{
				path: 'profile',
				data: {
					title: '系统配置',
				},
				component: ProfileComponent,
				runGuardsAndResolvers: 'always',
				resolve: {
					list: RepositoryListService,
        },
        canActivate: [CanActiveSuperAdmin]
			},
			{
				path: 'warehouse',
				data: {
					title: '内网仓库',
				},
				component: WarehouseComponent,
				runGuardsAndResolvers: 'always',
				resolve: {
					list: RepositoryListService,
				},
			},
			{
				path: 'platform_setting1',
				data: {
					title: '内网仓库111',
				},
				component: platformsettingComponent,
				runGuardsAndResolvers: 'always',
				resolve: {
					list: RepositoryListService,
				},
			},
			{
				path: 'client_update',
				component: ClientUpdateComponent,
				data: {
					title: '更新客户端',
				},
				runGuardsAndResolvers: 'always',
				resolve: {
					list: ClientUpdateService,
					architecture_list:ArchitectureService,
        },
        canActivate: [CanActiveSuperAdmin]
			},
			{
				path: 'platform_setting',
				component: ClientUpdateComponent,
				data: {
					title: '平台配置',
				},
				runGuardsAndResolvers: 'always',
				resolve: {
					// list: ClientUpdateService,
					// architecture_list:ArchitectureService,
        },
        canActivate: [CanActiveSuperAdmin]
			},
		],
	},
];

@NgModule({
	imports: [RouterModule.forChild(routes)],
	exports: [RouterModule],
})
export class SettingsRoutingModule {}
